<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
  <title>百度地图离线API V2.1  www.xiaoguo123.com</title>
	<style type="text/css">
  body, html,#map_demo, #tab, #mapfrm {width: 100%;height: 100%;overflow: hidden;margin:0;font-family:"微软雅黑";}
  #menu{height:100%;overflow-y:auto}
  td{font-size:14px}
  h4{margin:0;}
  #map_demo1,#map_demo2{height: 50%}
  </style>
  <script type="text/javascript" src="../../offlinemap/map_load.js"></script>
  <link rel="stylesheet" type="text/css" href="../../offlinemap/css/map.css"/>
  
  <script type="text/javascript" src="../jquery.js"></script>
  <script type="text/javascript" src="../layer/layer.js"></script>
</head>
<body>
<input type="button" onclick="add_control();" value="添加工具条、比例尺" />
<input type="button" onclick="delete_control();" value="删除" />
<div id="map_demo">1</div>
</body>
</html>
<script type="text/javascript">  

	// 百度地图API功能
	var map = new BMap.Map("map_demo");
	map.centerAndZoom(new BMap.Point(116.404, 39.915), 7);
	map.enableScrollWheelZoom(true);     //开启鼠标滚轮缩放
	
	var top_left_control = new BMap.ScaleControl({anchor: BMAP_ANCHOR_TOP_LEFT});// 左上角，添加比例尺
	var top_left_navigation = new BMap.NavigationControl();  //左上角，添加默认缩放平移控件
	var top_right_navigation = new BMap.NavigationControl({anchor: BMAP_ANCHOR_TOP_RIGHT, type: BMAP_NAVIGATION_CONTROL_SMALL}); //右上角，仅包含平移和缩放按钮
	/*缩放控件type有四种类型:
	BMAP_NAVIGATION_CONTROL_SMALL：仅包含平移和缩放按钮；BMAP_NAVIGATION_CONTROL_PAN:仅包含平移按钮；BMAP_NAVIGATION_CONTROL_ZOOM：仅包含缩放按钮*/
	
	//添加控件和比例尺
	function add_control(){
		map.addControl(top_left_control);        
		map.addControl(top_left_navigation);     
		map.addControl(top_right_navigation);    
	}
	//移除控件和比例尺
	function delete_control(){
		map.removeControl(top_left_control);     
		map.removeControl(top_left_navigation);  
		map.removeControl(top_right_navigation); 
	}
</script>